﻿using ShanNiang.Hosting.Enumerate;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ShanNiang.Hosting.Common
{
    /// <summary>
    /// 服务注入配置特性
    /// </summary>
    [AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct)]
    public class DILifetimeAttribute : Attribute
    {
        public DILifetimeAttribute(LifetimeType lifetimeType)
        {

            LifetimeType = lifetimeType;
        }
        /// <summary>
        /// 
        /// </summary>
        /// <param name="lifetimeType"></param>
        /// <param name="interfaceType"></param>
        public DILifetimeAttribute(LifetimeType lifetimeType, Type interfaceType) : this(lifetimeType)
        {
            InterfaceType = interfaceType;
        }
        public Type? InterfaceType { get; private set; }
        public LifetimeType LifetimeType { get; set; }
    }
}
